// 导入变量
@import 'variables';

// 导入混入
@import 'mixins';

// 导入动画
@import 'animations';

// 基础样式
body {
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    @include flex(column);
    min-height: 100vh;
    margin: 0;
    @include gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    @include theme-color(color, $text-color, $text-color-light);
}

.container {
    background-color: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: $border-radius-xl;
    @include shadow('lg');
    text-align: center;
    max-width: 800px;
    width: 95%;
    @include backdrop-blur(10px);
    @include animation(pageEnter, 0.8s);
    will-change: transform, opacity;
    @include transform(translateZ(0));
    
    @include dark-mode {
        background-color: rgba(26, 26, 26, 0.95);
    }
}

// 日历组件
.calendar {
    margin: 20px 0;
    border: none;
    border-radius: $border-radius-lg;
    overflow: hidden;
    background: white;
    @include shadow('sm');
    @include animation(calendarEnter, 0.6s);
    will-change: transform, opacity;
    @include transform(translateZ(0));
    contain: layout style paint;
    
    @include dark-mode {
        background: $bg-color-dark;
    }
}

.calendar-header {
    @include flex(row, space-between, center);
    padding: 15px;
    @include gradient(to right, $primary-color, $primary-dark);
    color: white;
    will-change: transform;
    @include transform(translateZ(0));
}

.calendar-header select,
.calendar-header button {
    padding: 8px 15px;
    border: none;
    border-radius: $border-radius;
    font-size: 15px;
    margin: 0 5px;
    cursor: pointer;
    @include transition(transform, background-color);
    
    &:hover {
        @include transform(translateY(-1px));
    }
    
    &:focus-visible {
        outline: 3px solid $focus-color;
        outline-offset: 2px;
    }
}

.calendar-header select {
    background: rgba(255, 255, 255, 0.9);
    @include theme-color(color, $text-color, $text-color-light);
}

.calendar-header button {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background-color: $bg-color;
    padding: 10px;
    @include transition(transform);
    will-change: transform;
    @include transform(translateZ(0));
    contain: layout style;
}

.calendar-weekday {
    background-color: $bg-color;
    padding: 12px;
    text-align: center;
    font-weight: 600;
    @include theme-color(color, $text-color, $text-color-light);
    font-size: 14px;
}

.calendar-day {
    background-color: white;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    @include transition(transform, background-color);
    border-radius: $border-radius;
    margin: 2px;
    position: relative;
    overflow: hidden;
    will-change: transform, opacity;
    @include transform(translateZ(0));
    contain: layout style paint;
    
    &:hover {
        background-color: #f0f0f0;
        @include transform(translateY(-2px));
        @include shadow('sm');
        @include animation(pulse, $animation-duration);
        will-change: transform;
    }
    
    &.today {
        border: 2px solid $primary-color;
        font-weight: bold;
    }
    
    &.selected {
        @include gradient(135deg, $primary-color, $primary-dark);
        color: white;
        font-weight: bold;
        @include transform(translateY(-2px));
        @include shadow('sm');
        @include animation(scaleIn, $animation-duration);
        will-change: transform, opacity;
        
        &::after {
            content: '';
            position: absolute;
            inset: 0;
            @include gradient(90deg, 
                rgba(255,255,255,0) 0%, 
                rgba(255,255,255,0.2) 50%, 
                rgba(255,255,255,0) 100%);
            background-size: 200% 100%;
            @include animation(shimmer, 2s, linear, 0s, infinite);
            will-change: background-position;
            @include transform(translateZ(0));
        }
    }
    
    &.other-month {
        color: #ccc;
        background: #fafafa;
        @include transition(transform, background-color);
        
        &:hover {
            @include transform(translateY(-2px) scale(1.05));
            background: #f0f0f0;
        }
    }
    
    &.weekend {
        color: $weekend-color;
    }
    
    &:focus-visible {
        outline: 3px solid $focus-color;
        outline-offset: 2px;
        z-index: 1;
    }
    
    @include dark-mode {
        background-color: $bg-color;
        color: $text-color-light;
        
        &:hover {
            background-color: $bg-color-darker;
        }
        
        &.other-month {
            color: #666;
            background: $bg-color-darker;
        }
    }
}

// 按钮组件
button {
    @include gradient(135deg, $primary-color, $primary-dark);
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: $border-radius;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    @include transition(transform, box-shadow);
    margin: 20px 0;
    position: relative;
    overflow: hidden;
    will-change: transform, opacity;
    @include transform(translateZ(0));
    contain: layout style paint;
    
    &:hover {
        @include transform(translateY(-2px));
        @include shadow('md');
        will-change: transform;
    }
    
    &:active {
        @include transform(scale(0.98));
    }
    
    &:focus-visible {
        outline: 3px solid $focus-color;
        outline-offset: 2px;
    }
}

// 结果区域
#result {
    margin: 25px 0;
    font-size: 1.3em;
    font-weight: 600;
    padding: 15px;
    border-radius: $border-radius;
    background: $bg-color;
    @include transition(transform, opacity);
    @include animation(resultEnter, 0.5s);
    will-change: transform, opacity;
    @include transform(translateZ(0));
    contain: layout style;
    
    &.updating {
        opacity: 0.5;
        @include transform(translateY(-10px));
        will-change: transform, opacity;
    }
    
    @include dark-mode {
        background: $bg-color;
        color: $text-color-light;
    }
}

// 关注列表
.focus-list {
    margin-top: 40px;
    background: white;
    padding: 20px;
    border-radius: $border-radius-lg;
    @include shadow('sm');
    @include animation(listEnter, 0.8s);
    will-change: transform, opacity;
    @include transform(translateZ(0));
    contain: layout style;
    
    h3 {
        @include theme-color(color, $text-color, $text-color-light);
        font-size: 20px;
        margin-bottom: 20px;
        font-weight: 600;
    }
    
    table {
        width: 100%;
        border-collapse: separate;
        border-spacing: 0;
        margin-top: 15px;
    }
    
    th, td {
        padding: 15px;
        text-align: left;
        border-bottom: 1px solid $border-color;
    }
    
    th {
        background-color: $bg-color;
        font-weight: 600;
        @include theme-color(color, $text-color, $text-color-light);
    }
    
    tr {
        @include animation(rowEnter, 0.3s);
        animation-fill-mode: both;
        @include transition(transform);
        will-change: transform;
        @include transform(translateZ(0));
        contain: layout style;
        
        &:nth-child(1) { animation-delay: 0.1s; }
        &:nth-child(2) { animation-delay: 0.2s; }
        &:nth-child(3) { animation-delay: 0.3s; }
        
        &:hover {
            @include transform(translateX(5px));
            background-color: $bg-color;
            @include shadow('sm');
            will-change: transform;
        }
        
        &:focus-visible {
            outline: 3px solid $focus-color;
            outline-offset: -2px;
        }
    }
    
    @include dark-mode {
        background: $bg-color;
        
        th {
            background-color: $bg-color-darker;
        }
        
        tr:hover {
            background-color: $bg-color-darker;
        }
    }
}

// 加载状态
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    @include flex(column);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    @include transition(opacity, visibility);
    @include backdrop-blur(4px);
    
    &.active {
        opacity: 1;
        visibility: visible;
    }
    
    @include dark-mode {
        background: rgba(0, 0, 0, 0.8);
    }
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid $border-color;
    border-top-color: $primary-color;
    border-radius: 50%;
    @include animation(spin, 1s, linear, 0s, infinite);
}

.loading-text {
    position: absolute;
    bottom: 40%;
    font-size: 16px;
    @include theme-color(color, $text-color, $text-color-light);
    @include animation(pulse, 1.5s, ease-in-out, 0s, infinite);
}

// 主题控制
.theme-controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    @include flex(column);
    gap: 10px;
    z-index: 1000;
    @include transition(transform);
    @include transform(translateX(0));
    @include animation(controlsEnter, 0.5s);
    
    &.hidden {
        @include animation(controlsExit, 0.3s, ease-in, 0s, 1, normal, forwards);
    }
    
    &::before {
        content: '🎨';
        position: absolute;
        left: -40px;
        top: 50%;
        @include transform(translateY(-50%));
        width: 30px;
        height: 30px;
        background: $bg-color;
        border: 2px solid $border-color;
        border-radius: 50%;
        @include flex;
        cursor: pointer;
        font-size: 16px;
        @include shadow('sm');
        @include transition(transform);
        
        &:hover {
            @include transform(translateY(-50%) scale(1.1));
        }
    }
}

#themeToggle {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    background: $bg-color;
    border: 2px solid $border-color;
    cursor: pointer;
    @include transition(transform);
    @include shadow('md');
    
    &:hover {
        @include transform(rotate(30deg));
    }
}

.theme-icon {
    font-size: 20px;
}

.theme-colors {
    @include flex(column);
    gap: 8px;
}

.theme-color-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 50%;
    border: 2px solid $border-color;
    background: var(--theme-color);
    cursor: pointer;
    @include transition(transform);
    @include shadow('sm');
    
    &:hover {
        @include transform(scale(1.1));
    }
}

// 响应式设计
@include respond-to('sm') {
    .container {
        width: 90%;
    }
}

@include respond-to('md') {
    .container {
        width: 85%;
    }
}

@include respond-to('lg') {
    .container {
        width: 80%;
    }
}

@include respond-to('xl') {
    .container {
        width: 75%;
    }
} 